package com.longxiao.validator.handler.cond;

import java.util.Arrays;

/**
 * Created by houhongwei on 2017/5/16.
 */
public class StringCondition extends CommCondition {

    // 字符串最小长度
    protected Integer minLen;
    // 字符串最大长度
    protected Integer maxLen;
    // 可选值
    protected String[] ref;
    // 正则表达式
    protected String regex;

    public StringCondition(boolean required, String name, String err) {
        super(required, name, err);
    }

    public StringCondition(boolean required, String name, String err, Integer minLen, Integer maxLen, String[] ref, String regex) {
        super(required, name, err);
        this.minLen = minLen;
        this.maxLen = maxLen;
        this.ref = ref;
        this.regex = regex;
    }

    @Override
    public String toString() {
        return "StringCondition{" +
                "minLen=" + minLen +
                ", maxLen=" + maxLen +
                ", ref=" + Arrays.toString(ref) +
                ", regex='" + regex + '\'' +
                '}';
    }

    public Integer getMinLen() {
        return minLen;
    }

    public void setMinLen(Integer minLen) {
        this.minLen = minLen;
    }

    public Integer getMaxLen() {
        return maxLen;
    }

    public void setMaxLen(Integer maxLen) {
        this.maxLen = maxLen;
    }

    public String[] getRef() {
        return ref;
    }

    public void setRef(String[] ref) {
        this.ref = ref;
    }

    public String getRegex() {
        return regex;
    }

    public void setRegex(String regex) {
        this.regex = regex;
    }
}
